#!/bin/bash

cd /var/www/scripts/terra_control/log
files=$(find *)
for i in $files ; do

	if [ "$i" == "logclean.sh" ]
	then
		continue
	fi

	echo "Serching for empty rows in file $i"
	grep "^$" "$i"

	if [ "$?" == "0" ]
	then 
		echo "Empty rows will now be deleted..."
    	grep -v "^$" "$i" >.tmpfile
    	cp .tmpfile "$i"
    	rm .tmpfile
	else

    	echo "No empty row found. Everything is clean."
	fi

done
